<template>
  <div class="app-container">
    <h1>App 根组件(父传子、子传父) --- {{countFromSan}}</h1>
    <hr />

    <div class="box">
      <!-- 渲染 Left 组件和 Right 组件 -->
      <Left :msg="message" :user="userinfo"></Left>
      <Right @numChange="getNewCount"></Right>
    </div>
  </div>
</template>

<script>
// 导入组件
import Left from "@/components/Left";
import Right from "@/components/Right";

export default {
  data(){
    return{
      message: 'Hello 2022!',
      userinfo: {
        name:'shina',
        age: 18
      },
      countFromSan: 0
    }
  },
  methods:{
    getNewCount(val){
      this.countFromSan = val
    }
  },

  // 注册组件
  components:{
    Left,
    Right,
  }

}
</script>

<style lang="less">
.app-container {
  padding: 1px 20px 20px;
  background-color: #efefef;
}
.box {
  display: flex;
}
</style>
